﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Profile.aspx.vb" Inherits="Dabke.Profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p style=" text-align: center; width: 100%;"> 
        <asp:Button ID="Button1" PostBackUrl="~/EditProfile.aspx" runat="server" Text="Edit My Profile" />
        </p>
<center>
    <p style=" text-align: center; width: 100%;">
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            SelectCommand="SELECT [UserName], [FirstName], [LastName], [UserPicture] FROM [TBL_Profile]">
        </asp:SqlDataSource>
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="UserName" DataSourceID="SqlDataSource2" GroupItemCount="4" style="width: 100%;">
                <AlternatingItemTemplate>
                    <td>
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><img alt="Profile Picture" width = "100" height = "100" src='../pictures/<%# Eval("UserPicture")%>'/></a>
                        <br />
                        <asp:Label ID="Lbl_FirstName" runat="server" Text='<%# Eval("FirstName") %>' /> 
                        <asp:Label ID="Lbl_LastName" runat="server" Text='<%# Eval("LastName") %>' />
                        <br />
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><%# Eval("UserName")%></a>
                    </td>
                </AlternatingItemTemplate>
                <EditItemTemplate>

                </EditItemTemplate>
                <EmptyDataTemplate>
                    <table runat="server" style="width: 100%">
                        <tr>
                            <td>
                                No data was returned.</td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <EmptyItemTemplate>
            
                </EmptyItemTemplate>
                <GroupTemplate>
                    <tr ID="itemPlaceholderContainer" runat="server">
                        <td ID="itemPlaceholder" runat="server">
                        </td>
                    </tr>
                </GroupTemplate>
                <InsertItemTemplate>

                </InsertItemTemplate>
                <ItemTemplate>
                    <td>
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><img alt="Profile Picure" width = "100" height = "100" src='../pictures/<%# Eval("UserPicture")%>'/></a>
                        <br />
                        <asp:Label ID="Lbl_FirstName" runat="server" Text='<%# Eval("FirstName") %>' /> 
                        <asp:Label ID="Lbl_LastName" runat="server" Text='<%# Eval("LastName") %>' />
                        <br />
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><%# Eval("UserName")%></a>
                    </td>
                </ItemTemplate>
                <LayoutTemplate>
                    <table id="Table2" runat="server">
                        <tr id="Tr1" runat="server">
                            <td id="Td5" runat="server">
                                <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                    <tr ID="groupPlaceholder" runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr id="Tr2" runat="server">
                            <td id="Td6" runat="server" style="">
                                <asp:DataPager ID="DataPager1" runat="server" PageSize="4">
                                    <Fields>
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                        <asp:NumericPagerField />
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                    </Fields>
                                </asp:DataPager>
                            </td>
                        </tr>
                    </table>
                </LayoutTemplate>
                <SelectedItemTemplate>
                    <td>
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><img alt="Profile Picure" width = "100" height = "100" src='../pictures/<%# Eval("UserPicture")%>'/></a>
                        <br />
                        <asp:Label ID="Lbl_FirstName" runat="server" Text='<%# Eval("FirstName") %>' /> 
                        <asp:Label ID="Lbl_LastName" runat="server" Text='<%# Eval("LastName") %>' />
                        <br />
                        <a href='Profile.aspx?UserName=<%# Eval("UserName") %>'><%# Eval("UserName")%></a>
                    </td>
                </SelectedItemTemplate>
            </asp:ListView>
    </p>
</center>

    <p>
        <br />
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" Height="50px" 
            Width="100%" DataKeyNames="UserName">
            <AlternatingRowStyle BackColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <EditRowStyle BackColor="#2461BF" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <Fields>
                <asp:ImageField DataImageUrlField="UserPicture" DataImageUrlFormatString="/pictures/{0}" HeaderText="Picture">
                    <ControlStyle CssClass="DetailImage" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:ImageField>
                <asp:BoundField DataField="UserName" HeaderText="User Name" ReadOnly="True" SortExpression="UserName" />
                <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                <asp:BoundField DataField="UserTitle" HeaderText="User Title" SortExpression="UserTitle" />
                <asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" />
                <asp:BoundField DataField="DOB" HeaderText="DOB" SortExpression="DOB" DataFormatString="{0:d}" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            </Fields>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:DetailsView>
    </p>
    <p style="width: 100%; text-align: center;">
        <asp:Button ID="Btn_RequestFriendShip" runat="server" Text="Request Friendship" />
    &nbsp;
        <asp:Label ID="LBL_Friendship" runat="server" Text=""></asp:Label>
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            SelectCommand="SELECT [UserName], [FirstName], [LastName], [UserPicture], [UserTitle], IIf([Gender]=2,  'Female' , 'Male') as [Gender] , [DOB], [Description] FROM [TBL_Profile] WHERE ([UserName] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="FirstName" QueryStringField="UserName" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <p>&nbsp;</p>
</asp:Content>
